<?xml version="1.0" encoding="utf-8"?>
<taskrunner name="uninstall.installed" version="1.2" date="2013-06-20" maxthreads="1">

  <!-- 
  log:
    2009-08-25/MMA Changed sub.folder.name to folders. The code-behind in @DeleteShortcut was also fixed!
    2013-06-20 : teriks28 : OGB project : 
      Added enum "uninstall.files" for uninstall files to be copied, added foreach to copy all the enums  
      Added input variable: "RestoreEswdl" that is used in task "alba.reinstall"
  -->

  <includes>
    <file name="vida.install.settings.xml" />
  </includes>

  <parameters>
    <parameter name="main.inst.type" value="#INPUT"/>
    <parameter name="RestoreEswdl" value="#INPUT"/>
  </parameters>

  <enumerations>
    <enum name="uninstall.files">
      <item key="vida.reinstall.uninstall.xml" source.dir="${install.src.uninstall.dir}\install" target.dir="${target.uninstall.dir}\install"/>
      <item key="vida.install.settings.xml" source.dir="${install.src.uninstall.dir}\install" target.dir="${target.uninstall.dir}\install"/>
      <item key="vida.douninstall.xml" source.dir="${install.src.uninstall.dir}\install" target.dir="${target.uninstall.dir}\install"/>
    </enum>
    
  </enumerations>

  <tasks>

    <task name="Write.restore.eswdl" typename="@WriteInformation">
      <parameters>
        <parameter name="message" value="vida.uninstall.installed.xml RestoreEswdl: ${RestoreEswdl}"/>
      </parameters>
    </task>

    <task name="Write.main.inst.type" typename="@WriteInformation">
      <dependencies list="Write.restore.eswdl"/>
      <parameters>
        <parameter name="message" value="vida.uninstall.installed.xml main.inst.type: ${main.inst.type}"/>
      </parameters>
    </task>

    <task name="check.dir" typename="@DirectoryExists">
      <dependencies list="Write.main.inst.type"/>
      <parameters>
        <parameter name="directory" value="${install.src.uninstall.dir}"/>
        <parameter name="output.value" value="dir.exist"/>
      </parameters>
    </task>

    <!--OGB 2013-06-03 teriks28-->
    <foreach enum="uninstall.files">

      <task name="copy.uninstall" condition="${main.inst.type}=REINSTALL AND ¤{dir.exist}=true" typename="@FileCopy" allowMultipleInstances="true">
      <description>
        Copies all files that will be neccessary to use during an uninstall of Vida.
      </description>
      <dependencies list="check.dir"/>
      <parameters>
          <parameter name="src" value="$[uninstall.files:source.dir]\$[uninstall.files:key]"/>
          <parameter name="dst" value="$[uninstall.files:target.dir]\$[uninstall.files:key]"/>
      </parameters>
    </task>

    </foreach>
		
		
		<!--CR3823 added dependencies-->
    <task name="alba.reinstall" typename="@CommandLine" condition="${main.inst.type}=REINSTALL">
      <dependencies list="copy.uninstall"/>
      <parameters>
        <parameter name="filename" value="%{VIDA_HOME}\uninstall\vida\alba.exe"/>
        <parameter name="arguments" value="/tasks %{VIDA_HOME}\uninstall\vida\install\vida.reinstall.uninstall.xml /overriderun true /log %{VIDA_HOME}\System\log\uninstall.log /p RestoreEswdl=${RestoreEswdl}"/>
        <parameter name="wait.for.exit" value="true"/>
        <parameter name="working.directory" value="%{VIDA_HOME}\uninstall\vida"/>
        <parameter name="error.words" value="[Error]"/>
      </parameters>
    </task>


    <task name="alba.uninstall" typename="@CommandLine" condition="${main.inst.type}=UNINSTALL">
      <dependencies list="copy.uninstall"/>
      <parameters>
        <parameter name="filename" value="%{VIDA_HOME}\uninstall\vida\alba.exe"/>
        <parameter name="arguments" value="/tasks %{VIDA_HOME}\uninstall\vida\install\vida.uninstall.xml /overriderun true /log %{VIDA_HOME}\System\log\uninstall.log /p RestoreEswdl=${RestoreEswdl}"/>
        <parameter name="wait.for.exit" value="true"/>
        <parameter name="working.directory" value="%{VIDA_HOME}\uninstall\vida"/>
        <parameter name="error.words" value="[Error]"/>
      </parameters>
    </task>

  </tasks>


</taskrunner>